package com.demo.livemanagement.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.demo.livemanagement.domain.LiveInformation;
import com.demo.livemanagement.service.LiveService;

//2017/11/07 17:42:59
@RestController
@RequestMapping("/live")
public class LiveController {

	@Autowired
	private LiveService liveService;

	@RequestMapping("/insert")
	public String insertLive(LiveInformation liveInformation) {
		System.out.println(liveInformation);
		liveService.insertLiveInformation(liveInformation);
		System.err.println("liveInformation:" + liveInformation);
		return "success:" + liveInformation;
	}

	// @Scheduled(fixedRate = 10000) //每十秒执行一次
	@Scheduled(cron = "0 0 0/1 * * ? ") // 每一小时执行一次]
	public void timer() {
		System.out.println(System.currentTimeMillis());
	}

}
